Linux コマンドメモ
\を最初につけることで、エイリアスが無効になる
rsync
a archive mode; equals -rlptgoD (no -H,-A,-X)
the ‘H’ option copies hardlinks
the ‘A’ option copies ACLs
the ‘X’ option copies extended attributes
the ‘x’ option don’t cross file system boundaries
the ‘S’ option handle sparse files efficiently
the ‘P’ option displays progress
fuser
ファイルやソケットを使用しているプロセスを特定
fuser -muv マウントポイント
u ユーザー
v commandの詳細情報を表示
htop
F9でkillモード
killシグナルのタイプを選択
code:xclip
# systemc clipboardにコピーできる
# パイプでつなげて、コンソール出力を渡すといい感じ
xclip -selection clipboard
find [指定フォルダパス] -type f -name "*.txt" | head -n 50
指定フォルダパスで、ファイル名検索。
find . -type f -newer newer
再帰的にファイル名を置換する
rename {before} {after} **/*.txt
ip -c
-c color出力
rm -i
-i は実行前に確認プロンプト表示
useradd
-c comment username fullname
nologinは -s ~/nologin のようにnologinを指定すれば良い。
w
ログインしているユーザーと実行中のプロセスを表示する
shred
ディスク完全削除
wc
文字数や行数カウント
-l
行数をカウント
code:du
du -h --max-depth=1
code:convmv
# * currentディレクトリのファイル全て
convmv -r -f cp932 -t utf-8 --notest *
code:iconv
`
iconv -f utf8 -t sjis sample.txt -c > sample.txt
# -cで変換できない文字列をスキップする
code:rename
# htmをhtmlの拡張子に変換
rename htm html *.htm
grep
-v 除外する
code:diff
diff -u in.txt in2.txt | grep ^+ | grep -v ^+++
code:tree
tree -I "*.html|*.png|*.jpg"
code:fuser
fuser -f
cp -r ./.
dotfileもコピーする
sqlのjoinみたい
片方にしか存在しない場合切り捨てられる
code:join
# 一致に使う項目を2番目に指定する
# -j オプション無しでは1番目になる
join -j 2
ls -lSr
-S ファイルサイズ